package com.um.weixin.mp.service.impl;

import com.um.weixin.mp.service.WxMpMsgService;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title
 * @Description
 * @Author renjunwei
 * @Date 2023/5/31 17:33
 */
@Service
@Slf4j
public class WxMpMsgServiceImpl implements WxMpMsgService {

    @Autowired
    WxMpService wxMpService;

    /**
     * <pre>
     * 发送模板消息
     * 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN
     * </pre>
     *
     * @param templateMessage 模板消息
     * @return 消息Id
     * @throws WxErrorException .
     */
    @Override
    public String sendTemplateMsg(WxMpTemplateMessage templateMessage) throws WxErrorException {
        return wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
    }

}
